package com.leeyu.rabbitmq.listener;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Map;

@Component
public class CouponListener {

    @RabbitListener(queues = "coupon_queue")
    public void consume(Map<String, Object> msg, Channel channel, Message message) throws IOException {
        System.out.println("优惠券服务消费下单消息：" + msg);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
    }
}
